{% extends "base.html" %}
{% load humanize %}
{% load bootstrap_pagination %}

{% block content %}
    <div class="row">
        <div class="col-md-8">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">
                    待译原文
                    <small class="pull-right">
                        排序方式：<a href="{{ sort_urls.recommend }}">推荐时间</a> |
                                            <a href="{{ sort_urls.schedule }}">翻译进度</a>
                    </small>
                    </h3>
                </div>
                <div class="panel-body">
                    {% for article in untranslated %}
                        {% if forloop.counter0 %}<hr>{% endif %}
                        <h4><a href="{% url 'translations:detail' article.id %}">{{ article.original_title }}</a></h4>
                        <h5>{{ article.title }} (
                        {% with article.translate_rate as translate_rate %}
                            {% if translate_rate > 0 %}
                                已翻译{{ translate_rate }}%
                            {% else %}
                                未翻译
                            {% endif %}
                        {% endwith %}
                        )</h5>
                        <small><a href="{{ article.recommend_user.profile.get_absolute_url }}">{{ article.recommend_user.profile }}</a> 推荐于 {{ article.recommend_date|naturaltime }}</small>
                        <p>{{ article.section_set.first.content|striptags|truncatewords:50 }}</p>
                    {% endfor %}

                    {% if untranslated.paginator.num_pages > 1 %}
                        <hr>
                        {% bootstrap_paginate untranslated range=10 %}
                    {% endif %}
                </div>
            </div>
        </div>

        <div class="col-md-4">
            <img data-src="holder.js/294x70" style="margin-bottom: 10px">

            {% if user.is_authenticated %}
                {% include "translations/partial_recommend.html" %}
            {% endif %}
        </div>
    </div>
{% endblock %}